﻿@model IEnumerable<DotNetUniLodz.Models.User>

@{
    ViewBag.Title = "Użytkownicy";
}
<div id="Content100">
    <h2>@ViewBag.Title</h2>

    <table id="NormalTable">
        <tr>
            <th>Login
            </th>
            <th>Imię
            </th>
            <th>Nazwisko
            </th>
            <th>Email
            </th>
            <th>Ranga
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.User_login)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.User_firstName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.User_lastName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.User_mail)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Role.Role_name)
                </td>
                <td>
                    @Html.ActionLink("Szczegóły", "Details", new { id = item.User_id })
                    @if (User.IsInRole("Admin") && (User.Identity.Name != item.User_login && item.User_login != "Anonimowy"))
                    { <text>|</text>
                        @Html.ActionLink("Usuń Konto", "Delete", new { id = item.User_id })
                    }
                </td>
            </tr>
        }

    </table>
</div>
